/*
 * CQualityFilter.java
 *
 * Copyright (c) 2009 Giles Millward (Manigra). All rights reserved.
 *
 * This file is part of JRogueDPS.
 *
 * JRogueDPS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JRogueDPS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JRogueDPS.  If not, see <http://www.gnu.org/licenses/>.
 */

package geardatabase;

import geardatabase.CItemQuality.ItemQuality;

/**
 *
 * @author Mani
 */
public class CQualityFilter {
    private boolean m_legendary;
    private boolean m_epic;
    private boolean m_rare;
    private boolean m_uncommon;
    private boolean m_common;

    public CQualityFilter(boolean p_legendary, boolean p_epic, boolean p_rare, boolean p_uncommon, boolean p_common)
    {
        m_legendary = p_legendary;
        m_epic = p_epic;
        m_rare = p_rare;
        m_uncommon = p_uncommon;
        m_common = p_common;
    }

    public void setFilter(ItemQuality p_itemQuality, boolean p_flag)
    {
        if (p_itemQuality == ItemQuality.COMMON)
        {
            this.m_common = p_flag;
        } else if (p_itemQuality == ItemQuality.UNCOMMON)
        {
            this.m_uncommon = p_flag;
        } else if (p_itemQuality == ItemQuality.RARE)
        {
            this.m_rare = p_flag;
        } else if (p_itemQuality == ItemQuality.EPIC)
        {
            this.m_epic = p_flag;
        } else if (p_itemQuality == ItemQuality.LEGENDARY)
        {
            this.m_legendary = p_flag;
        }
    }

    public boolean isFiltered(ItemQuality p_itemQuality)
    {
        if (p_itemQuality == ItemQuality.COMMON && m_common)
        {
            return true;
        } else if (p_itemQuality == ItemQuality.UNCOMMON && m_uncommon)
        {
            return true;
        } else if (p_itemQuality == ItemQuality.RARE && m_rare)
        {
            return true;
        } else if (p_itemQuality == ItemQuality.EPIC && m_epic)
        {
            return true;
        } else if (p_itemQuality == ItemQuality.LEGENDARY && m_legendary)
        {
            return true;
        }

        return false;
    }
    /**
     * @return the m_legendary
     */
    public boolean isLegendary() {
        return m_legendary;
    }

    /**
     * @param m_legendary the m_legendary to set
     */
    public void setLegendary(boolean m_legendary) {
        this.m_legendary = m_legendary;
    }

    /**
     * @return the m_epic
     */
    public boolean isEpic() {
        return m_epic;
    }

    /**
     * @param m_epic the m_epic to set
     */
    public void setEpic(boolean m_epic) {
        this.m_epic = m_epic;
    }

    /**
     * @return the m_rare
     */
    public boolean isRare() {
        return m_rare;
    }

    /**
     * @param m_rare the m_rare to set
     */
    public void setRare(boolean m_rare) {
        this.m_rare = m_rare;
    }

    /**
     * @return the m_uncommon
     */
    public boolean isUncommon() {
        return m_uncommon;
    }

    /**
     * @param m_uncommon the m_uncommon to set
     */
    public void setUncommon(boolean m_uncommon) {
        this.m_uncommon = m_uncommon;
    }

    /**
     * @return the m_common
     */
    public boolean isCommon() {
        return m_common;
    }

    /**
     * @param m_common the m_common to set
     */
    public void setCommon(boolean m_common) {
        this.m_common = m_common;
    }

}
